package cm.hyb.Controller.converter;

import java.text.DateFormat;
import java.text.ParseException;
import java.util.Date;

import javax.annotation.Resource;

import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

//日期类型转换器
@Component
public class String1DateConvertor implements Converter<String , Date>{

	@Resource
	private DateFormat format;

	@Override
	public Date convert(String args) {
//		SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
		try {
			return format.parse(args);
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}
}
